/*

Load an image (using cv::imread )
Create a named OpenCV window (using cv::namedWindow )
Display an image in an OpenCV window (using cv::imshow )

http://docs.opencv.org/trunk/db/deb/tutorial_display_image.html

Data:2017.04.23

*/


#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
#include <string>

using namespace cv;
using namespace std;

int main(int argc, char** argv )
{

    String imageName("../data/image.jpg");
    if( argc > 1)
    {
        imageName = argv[1];
    }
    Mat image = imread( imageName, IMREAD_COLOR ); // Read the file
    Mat image_gray = imread( imageName, IMREAD_GRAYSCALE);
    if( image.empty() )                      // Check for invalid input
    {
        cout <<  "Could not open or find the image" << std::endl ;
        return -1;
    }
    namedWindow( "Display window", WINDOW_AUTOSIZE ); // Create a window for display.
    imshow( "Display window", image );                // Show our image inside it.
    imshow( "Display window2", image_gray );                // Show our image inside it.
    waitKey(0); // Wait for a keystroke in the window
    return 0;
}
